var DataSourceTree = function(options) {
	this._data 	= options.data;
	this._delay = options.delay;
}



DataSourceTree.prototype.data = function(options, callback) {
	var self = this;
	var $data = null;

	if(!("name" in options) && !("type" in options)){
		$data = this._data;//the root tree
		callback({ data: $data });
		return;
	}
	else if("type" in options && options.type == "folder") {
		if("additionalParameters" in options && "children" in options.additionalParameters)
			$data = options.additionalParameters.children;
		else $data = {}//no data
	}
	
	if($data != null)//this setTimeout is only for mimicking some random delay
		setTimeout(function(){callback({ data: $data });} , parseInt(Math.random() * 500) + 200);

	//we have used static data here
	//but you can retrieve your data dynamically from a server using ajax call
	//checkout examples/treeview.html and examples/treeview.js for more info
};

// var tree_data_3 = {
// 	'weekly-reports' : {name: 'Weekly Reports', type: 'folder'},
// 	'employees' : {name: 'Employees', type: 'folder'},
// 	'departments' : {name: 'Departments', type: 'item'},
// 	'benefits' : {name: 'Benefits', type: 'item'}
// }
// tree_data_3['weekly-reports']['additionalParameters'] = {
// 	'children' : {
// 		'company-sales' : {name: 'Company Sales', type: 'item'},
// 		'employee-sales' : {name: 'Employee Sales', type: 'item'},
// 		'foodmart-sales' : {name: 'Foodmart Sales', type: 'item'},
// 		'product-catalog' : {name: 'Product Catalog', type: 'item'},
// 		'productline-sales' : {name: 'Product Line Sales', type: 'item'},
// 		'discounted-sales' : {name: 'Discounted sales', type: 'item'},
// 		'sales-detail' : {name: 'Sales Order Detail', type: 'item'}
// 	}
// }
// tree_data_3['employees']['additionalParameters'] = {
// 	'children' : {
// 		'cooks' : {name: 'Cooks', type: 'item'},
// 		'assistants' : {name: 'Assistants', type: 'item'},
// 		'waters' : {name: 'Waiters', type: 'item'}
// 	}
// }
//
// var treeDataSource3 = new DataSourceTree({data: tree_data_3});